package week6.member.personcmp;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Random;

public class TPCmp {
    public static void main(String[] args) {
        Person[] personArray = new Person[10];
        Random rdn = new Random();
        for (int i=0;i<personArray.length;i++){
            personArray[i] =new Person("Person"+i, rdn.nextInt(200), rdn.nextInt(200));
        }
        for (int i=0;i<personArray.length;i++){
            System.out.println(personArray[i].getName()+":"+personArray[i].getHeight());
        }
       /* System.out.println("排序之后");
        Arrays.sort(personArray, new Comparator<Person>() {
            @Override
            public int compare(Person o1, Person o2) {
                return o1.getHeight() - o2.getHeight();
            }
        });*/
    }
}
